<?php 
// 通用函数
require_once( FPATH.'core/functions.php');

/*
 * ------------------------------------------------------
*  Instantiate the config class
* ------------------------------------------------------
*/
$CFG =& load_class('Config', 'core');

/*
 * ------------------------------------------------------
*  载入URI类
* ------------------------------------------------------
*/
 $URI=load_class('URI', 'core');
//$URI =new URI();

/*
 * ------------------------------------------------------
*  载入ROUTER类
* ------------------------------------------------------
*/
require_once( FPATH.'core/ROUTER.php');
$ROUTER =new ROUTER();
$ROUTER->_set_routing();

//输出类
$OUT =& load_class('Output', 'core');

// 载入控制器基类
require FPATH.'core/Controller.php';

function &get_instance()
{
	return Controller::get_instance();
}
// 判断路由指向的目录与控制器类文件是否存在
if ( ! file_exists(APPPATH.'controllers/'.$ROUTER->get_directory().'/'.$ROUTER->get_class().'.php'))
{
	exit('您访问的页面不存在.');
}

include(APPPATH.'controllers/'.$ROUTER->get_directory().'/'.$ROUTER->get_class().'.php');

/*
 * 实例化目标控制器
 */
$class=$ROUTER->get_class();
$method=$ROUTER->get_method();
$lk = new $class();

// echo $ROUTER->get_directory()."<br>";
// echo $class."<br>";
// echo $method."<br>";
// print_r(method_exists($lk,$method));

//print_r($URI->segments);
if(method_exists($lk,$method)){
	call_user_func_array(array(&$lk, $method), array_slice($URI->segments, 2));	
}

//输出buffer
$OUT->_display();
/* End of file Lookphp.php */
/* Location: ./lookphp/core/Lookphp.php */



